<template> 
    <div class="feedback"> 
        <textarea placeholder="请留下你的宝贵意见，我们会认真阅读并更好的优化产品" v-model="content"></textarea> 
        <div class="footer">
            <div class="btn text-center" @click="postInfo">确定</div>
        </div> 
    </div> 
</template>

<script> 
import * as api from '@/utils/api' 
export default {
    onLoad (opt){   
        this.content="";   
    },
    data () {
        return {
            content:''
        }
    },
    methods:{
        postInfo(){
            let vm = this;
            if(vm.content){
                let body={
                model: "Suggestions",
                    data: {
                        uid: wx.getStorageSync('u_id'),
                        content:vm.content
                    }
                };
                api.createSite(body).then(res=>{
                    if(res.data.code==200){
                        wx.showToast({
                            title: '反馈成功',
                            icon: 'succes', 
                            mask:true
                        })
                        setTimeout(()=>{
                            wx.navigateBack({ delta: 1});
                        },1000); 
                    }
                });
            }else{
                wx.showToast({ title: '内容不能为空', icon: 'none'  })
            }
            
        },
    }, 
}

</script>
<style lang="scss">
 
.feedback{
    width:100%;
    height:100%;
    font-size:28rpx;
    padding:20rpx 30rpx;
    box-sizing:border-box; 
    textarea{
        width:100%;
        padding:20rpx 30rpx;
        box-sizing:border-box;
        border:1rpx solid #ECECEC;
        background:#fff;
    }
    .footer{
        width:100%;
        margin-top:40rpx;
        font-size:30rpx;
        .btn{
            width:80%;
            padding:20rpx;
            box-sizing:border-box;
            margin:auto;
            background:#CD4640;
            color:#fff;
            border-radius:20rpx;
            &:active{
                background-color:rgba(205,70,64,0.5)
            }
        }
    }
} 
</style>
